Skip to content

feat(stylus) - initialize and update fees for pyth contract #2795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 63 commits into from
Jul 11, 2025

Conversation

ayushboss
Copy link
Contributor

Summary

Implementing the necessary initialization and update functions for the pyth contract stylus implementation.

Rationale

These functions are the backbone of the contract.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Will be able to implement unit tests on this contract once these changes are done. Initial tests will be conducted through standard cargo test functionality, but then additional tests conducted through change are also possible through features of the stylus framework.

Copy link

vercel bot commented Jun 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm
developer-hub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 8:49pm

…pdate all price feeds. some cargo build errors, but will fix in next commit
devin-ai-integration bot and others added 2 commits July 9, 2025 21:42
- Modified get_current_timestamp to use MockClock::time().as_secs() in test mode
- Added MockClock::set_time(Duration::from_secs(1761573860)) to three specific tests:
  - test_get_price_no_older_than_with_random_id_reverts_with_price_unavailable
  - test_get_price_no_older_than_where_update_younger_than_max_age_returns_price
  - test_get_price_no_older_than_reverts_too_old
- Contract functionality unchanged (still uses block_timestamp in production)
- All specified tests pass with mocked timestamp

Co-Authored-By: ayush.suresh@dourolabs.xyz <byteSlayer31037@gmail.com>
- Added #[cfg(test)] to all 9 functions in test_data.rs:
  - good_update1()
  - good_update2()
  - multiple_updates_same_vaa()
  - multiple_updates_diff_vaa()
  - multiple_updates_diff_vaa_results()
  - good_update1_results()
  - multiple_updates_results()
  - good_update2_results()
  - current_guardians()
- Ensures test data functions are only compiled during testing
- All tests continue to pass with cfg(test) attributes

Co-Authored-By: ayush.suresh@dourolabs.xyz <byteSlayer31037@gmail.com>
wormhole_contract: Contract<WormholeContract>,
alice: Address,
) {
MockClock::set_time(Duration::from_secs(1761573860));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this timestamp is less than good_update2().timestamp + 1s? would be good to clarify the test setup in a comment

governance_emitter_chain_id: u16,
governance_emitter_address: [u8; 32],
governance_initial_sequence: u64,
_data: Vec<u8>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants